package com.xoa.controller.party;



import com.xoa.model.party.SmallScaleSecurityUnitWithBLOBs;
import com.xoa.service.party.SmallScaleSecurityUnitService;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/sv1/smallscalesecurityunit")
public class SmallScaleSecurityUnitController {
    @Autowired
    private SmallScaleSecurityUnitService smallScaleSecurityUnitService;

    /**
     * 增
     * @param smallScaleSecurityUnitWithBLOBs
     * @return
     */
    @ResponseBody
    @RequestMapping("/insertSelective")
    public ToJson insertSelective(SmallScaleSecurityUnitWithBLOBs smallScaleSecurityUnitWithBLOBs,
                                  String tbr, String lxdh, String tbsj ){
        smallScaleSecurityUnitWithBLOBs.setFormHolder(tbr);
        smallScaleSecurityUnitWithBLOBs.setUnitLocationTown(lxdh);
        smallScaleSecurityUnitWithBLOBs.setDateOfPublication(tbsj);
        return smallScaleSecurityUnitService.insertSelective(smallScaleSecurityUnitWithBLOBs);
    }

    /**
     * 主键删除
     * @param smallScaleSecurityUnitId
     * @return
     */
    @ResponseBody
    @RequestMapping("/deleteById")
    public ToJson deleteById(int smallScaleSecurityUnitId){
        return smallScaleSecurityUnitService.deleteById(smallScaleSecurityUnitId);
    }

    /**
     * 修改
     * @param smallScaleSecurityUnitWithBLOBs
     * @return
     */
    @ResponseBody
    @RequestMapping("/updateSelectiveById")
    public ToJson updateSelectiveById(SmallScaleSecurityUnitWithBLOBs smallScaleSecurityUnitWithBLOBs, String tbr, String lxdh, String tbsj ){
        smallScaleSecurityUnitWithBLOBs.setFormHolder(tbr);
        smallScaleSecurityUnitWithBLOBs.setUnitLocationTown(lxdh);
        smallScaleSecurityUnitWithBLOBs.setDateOfPublication(tbsj);
        return smallScaleSecurityUnitService.updateSelectiveById(smallScaleSecurityUnitWithBLOBs);
    }

    /**
     * 主键查询
     * @param smallScaleSecurityUnitId
     * @return
     */
    @ResponseBody
    @RequestMapping("/selectById")
    public ToJson selectById(int smallScaleSecurityUnitId){
        return smallScaleSecurityUnitService.selectById(smallScaleSecurityUnitId);
    }

    /**
     * 分页条件查询
     * @param page
     * @param pageSize
     * @param useFlag
     * @param smallScaleSecurityUnitWithBLOBs
     * @return
     */
    @ResponseBody
    @RequestMapping("/selectSelective")
    public ToJson selectSelective(Integer page, Integer pageSize, boolean useFlag,
                                  SmallScaleSecurityUnitWithBLOBs smallScaleSecurityUnitWithBLOBs){
        return smallScaleSecurityUnitService.selectSelective(page,pageSize,useFlag,smallScaleSecurityUnitWithBLOBs);
    }


}
